All Questions
Tagged with parsingreinventing-the-wheel
35 questions
6votes
4answers
894views
Very simple CSV-parser in Java
Please take a look at my method for parsing a CSV string. I am looking for a simple approach without using an external library. Is throwing a RuntimeException ...
8votes
3answers
2kviews
is_decimal Function Implementation in C++
This is a follow-up question for is_number Function Implementation in C++. Considering G. Sliepen's answer and Harith's answer, I want to focus on decimal number here, therefore, ...
4votes
2answers
710views
is_number Function Implementation in C++
I am trying to implement a function which can determine a string is a number or not. Both positive and negative integers / floating numbers are considered. The experimental implementation ...
2votes
1answer
200views
Evaluate a prefix expression
The algorithm involves using two stacks. One stack (call it token_stack) holds the operators (like +, - etc) and operands (like 3,4 etc) and the other stack (call it count_stack) holds the number of ...
2votes
2answers
121views
Evaluating Polish Prefix Notation and Polish Postfix Notation
In Polish postfix notation, the operators follow their operands. For example, to add 3 and 4 together, the expression is 3 4 + rather than 3 + 4. The conventional notation expression 3 − 4 + 5 becomes ...
1vote
1answer
143views
Company database REPL program in Rust for Chapter 8 of The Book
Using a hash map and vectors, create a text interface to allow a user to add employee names to a department in a company. For example, “Add Sally to Engineering” or “Add Amir to Sales.” Then let the ...
2votes
2answers
288views
A postfix (a.k.a. Reverse-Polish Notation - RPN) calculator
As an exercise, I put together a postfix calculator using modern Fortran. Language apart, I am interested in knowing your take on the algorithm. As far as I remember from my freshman year (chemistry - ...
6votes
1answer
1kviews
Parsing a JSON one line at a time in Python
happy 2021 everyone! I started coding some months ago for fun and recently I challenged myself to build a JSON parser in Python (v3.8). The basic idea was to avoid loading the whole file at once, ...
11votes
3answers
732views
FASTA-to-tsv conversion script
I worked on a script that takes as input a multi-sequence .fasta file and outputs the number of each aminoacid/sequence in a .tsv...
5votes
0answers
146views
Scanning a string into a list of tokens
Here is my code: ...
6votes
2answers
265views
Compact command line argument parser : Revisited
This question is a follow up to my previous one which can be found here. The user dfhwze suggested me to look into compiler construction and recommended me to write a lexer and a parser that would ...
2votes
1answer
507views
Compact command line argument parser
So, I decided to write my own little command line argument parser for various other projects I work on. I am aware that there are many good command line parser libraries, but I did wrote my own anyway ...
3votes
1answer
1kviews
C++ program that processes unique markup language similar to HTML
I have solved a task which takes input in a unique markup language. In this language each element consists of a starting and closing tag. Only starting tags can have attributes. Each attribute has a ...
2votes
4answers
900views
Split a string into a list of tokens
I have the following assignment that I succeeded in solving, but the code is very inefficient. I would appreciate if someone could show me a more efficient way, perhaps with substring. Note that I am ...
9votes
1answer
141views
Minimal regex engine
A few months back, I posted a state machine for review. Thanks to the feedback, I was able to greatly simplify the implementation. I am posting the revised version, together with the Regex class which ...